﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using Thaire.Investment.Domains.Transaction;

namespace Thaire.Investment.Repository
{
    public class FixIncomeSecuritiesPurchaseRepo : BaseRepository<FixincomesecuritiesPurchase, int>
    {
        public FixIncomeSecuritiesPurchaseRepo(ISession session)
            : base(session)
        {
        }

        public List<FixincomesecuritiesPurchase> GetListByHeaderId(int headerId)
        {
            return new List<FixincomesecuritiesPurchase>(_session.QueryOver<FixincomesecuritiesPurchase>()
                .Where(x => x.FixincomesecuritiesHeaderId == headerId)
                .OrderBy(x => x.CreateTs).Asc.List());
        }

        public List<FixIncomeSecuritiesTransaction> GetListFixIncomeSecuritiesTransactionByPurchaseId(int purchaseID)
        {
          return  new FixIncomeSecuritiesTransactionRepo(_session).GetListByAndPurchaseID(purchaseID).ToList();
        }
        
    }
}
